<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>axios学习笔记</title>
    <script src="axios.js"></script>
</head>
<body>
<script>
  // axios作为方法调用
  axios({
    url: 'http://localhost:8080/user/list',
    method: 'get'
  }).then(response => {
    // 注意: 最好拿出 data
    console.log('数据获取成功', response.data)
  }).catch(error => {
    console.log('数据获取失败', error)
  })

  // axios作为对象调用
  axios.get('http://localhost:8080/user/list')
    .then(response => {
      console.log('数据获取成功', response.data)
    })
    .catch(error => {
      console.log('数据获取失败', error)
    })
</script>
</body>
</html>